var mysql   = require('mysql');
var connection = mysql.createConnection({
 host   :'localhost',
 user   : 'root',
 password : 'root',
 database : 'xueqian'
});
var db={};
db.query=function(sql,fn){
    if(!sql) return;
    connection.query(sql,(err,rows,field)=>{
        if(err){
            return ;
        }
        fn(rows);
    })   
}
module.exports=db;